const LogicErrException = require('../../exception/logicError');

const Controller = require('egg').Controller;
class BaseController extends Controller {
  success(result) {
    if (!result) {
      throw new LogicErrException("返回数据异常！");
    }
    const { ctx } = this;
    const { code, message, data } = result;
    ctx.body = {
      code,
      message,
      data
    };
  }
}
module.exports = BaseController;